<!--#include file="../nav/admin_top.php" -->
<div class="titleDiv">
	<div class="titleCaption">
		<span class="captionSpan">配送批次 - 修改配送批次</span>
		<span class="totalSpan"> <label id="captionNum"></label> </span>
	</div>
</div>
  

<style type="text/css">
a.modify_a{
position:absolute;
right:30px;
top:5px;
}
.statusout{
position:relative;
}
.statusdiv{
float:left;
margin:5px;
border:1px solid #EBEBEB;
padding:5px;
color:#CCCCCC;
}
.statusdiv_on{
color:#FF6633;
background:url(/misc/images/yes.gif) top 5px left 3px no-repeat #FFFFCC;
padding-left:23px;
}


.vegediv_fix{
border: 1px solid #B2D9F0;
color: #0082CB;
background-color:#E8F3FF;
float: left;
margin: 1px 3px;
padding: 3px;
text-decoration: none;
}

.vegediv_slt{
border: 1px solid #CCCCCC;
color: #999999;
float: left;
margin: 1px 3px;
padding: 3px;
text-decoration: none;
}
.vegediv_slt_on{

border: 1px solid #B2D9F0;
color: #0082CB;
background-color:#E8F3FF;
}





table.packettb{
border-collapse:collapse;
width:100%;
}
table.packettb td{
border:1px solid #E8E8E8;
}
table.packettb tbody td.title{
color:#FF6600;
font-size:18px;
font-weight:bold;
padding:10px;
text-align:center;
}
table.packettb tbody td.info{
color:#666666;
font-size:14px;
padding:10px;

}
table.packettb thead th{
padding:7px;
background:#E9F7DF;
color:#666666;
border:1px solid #E8E8E8;
text-align:center;
}

</style>
  
<div class="blockdiv">
	<div class="titlediv">基本信息</div>
	<a href="javascript:void(0)" onclick="fnModifyInfo()" class="modify_a">修改基本信息</a>
	<table class="mytable" > 
		<tr>
			<td class="mylabel">状态：</td>
			<td class="myinfo" colspan="1" > 
				<div class="statusout">
					<div class="statusdiv <?PHP if($rs_sendpi['status'] == '0') echo 'statusdiv_on';?>">计划中</div>
					<div class="statusdiv <?PHP if($rs_sendpi['status'] == '1') echo 'statusdiv_on';?>">生产中</div>
					<div class="statusdiv <?PHP if($rs_sendpi['status'] == '2') echo 'statusdiv_on';?>">已完成</div>
				</div>
			</td> 
			<td class="mylabel">是否包含溯源信息：</td>
			<td class="myinfo" > 
				<?PHP
				if($rs_sendpi['onsource'] == '1'){
					echo '<span style="color:#006600;font-size:14px;">是</span>';
				}else{
					echo '<span style="color:red;font-size:14px;">否</span>';
				}
				?>
			</td> 
		</tr> 	
		<tr>	
			<td class="mylabel"> 配送批次编号：</td>
			<td class="myinfo" style="color:#333333;font-size:14px;" > 
				<input type="hidden" id="id" name="id" value="{$rs_sendpi.id}" /> 
				{$rs_sendpi.code}
			</td>
			<td class="mylabel">配送日期：</td>
			<td class="myinfo" style="color:#FF3333;font-size:14px;" > 
				{$rs_sendpi.senddate}
			</td> 		
		</tr>
		<tr>
			<td class="mylabel"> 创建人：</td>
			<td class="myinfo" > 
				{$rs_sendpi.created_username} ({$rs_sendpi.created})
			</td>
			<td class="mylabel"> 最后修改人：</td>
			<td class="myinfo" > 
				{$rs_sendpi.updated_username} ({$rs_sendpi.updated})
			</td>
		</tr>
		<tr>
			<td class="mylabel">备注说明：</td>
			<td class="myinfo"  colspan="3" >{$rs_sendpi.remark}</td>
		</tr>
	</table> 
</div>
<div class="blockdiv">
	<div class="titlediv">配送分支（共 {$rs_sendpi.sendfennum} 个）</div>
	<div class="menuBg"  >
		<a class="menuAdd" href="javascript:void(0)" onclick="fnAddSendFen()">添加配送分支</a> 
		<div style="clear:both"></div>
	</div>
	<div id="grids"></div> 
</div>
<div  class="button_div">
		<button class=" " onclick="fnReturn()">返 回</button>
</div>
<script type="text/javascript">
var url_list = '/admin_sendfen/list';
var url_del = '/admin_sendfen/del';
var url_return = '/admin_sendpi/index';
$().ready(function(){
	o2js.build('ymprompt');
	o2js.build('dates');
	o2js.build('jquery_cluetip');
	o2js.build('o2grid');
	showLoading();
	grids = new o2Grid({
		bind:'grids', 
		url:url_list,
		pageNum:20,
		imgpath:'/misc/vendors/o2js/o2grid/image',
		cols:[
			{index:'id',mapping:'a.id', name:'序号', width:35,sortable:false, func:function(val,row_index,column_name,json,R){
				 return  '<span title="ID：'+json.id+'" >'+((R.page - 1)*R.rowNum + (row_index+1))+'</span>';
			}}, 
			{index:'name',mapping:'a.name', name:'配送分支标识', width:200,func:function(val,row_index,column_name,json,R){
					return val;
				}
			},
			{index:'users',mapping:'a.users', name:'配送会员数',align:"center", width:150 ,func:function(val,row_index,column_name,json,R){
				return '<a href="javascript:void(0)" onclick="fnLookUsers('+json.id+')">'+json.users+'</a> ';
			}
			},
			{index:'packetnum',mapping:'a.packetnum', name:'包装种类数', align:"center",width:150 ,func:function(val,row_index,column_name,json,R){
				return '<a href="javascript:void(0)" onclick="fnLookPacket('+json.id+')">'+json.packetnum+'</a> ';
			}
			},
			{index:'created',mapping:'a.created', name:'配送分支创建时间', width:200
			},
			{index:'id',mapping:'a.id', name:'操作', width:140,sortable:false,func:function(val,row_index,column_name,json,R){
				var s = '<a href="javascript:void(0)" onclick="fnModifyFen('+json.id+')" > 修改</a> ';
				s += ' &nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" onclick="fnfuzhi('+json.id+')" > 复制</a> ';
				s += ' &nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" onclick="fnDelFen('+json.id+')" > 删除</a> ';
				return s;
			}
			}
		],
		baseParams:{
			sendpi_id:{$rs_sendpi.id}
		}
	});
	grids.load(1); 
});
/* 修改基本信息 */
function fnModifyInfo(){
	ymPrompt.close();
	ymPrompt.win({
		title:'修改配送批次基本信息',
		fixPosition:true,
		maxBtn:true,
		width: 700, 
		height: 400,
		iframe:{
			src:'/admin_sendpi/piinfo_modify?id='+{$rs_sendpi.id}+'&endfunc=fnModifyInfoEnd'
		}
	});
} 
function fnModifyInfoEnd(){
	window.location.reload();
}

function fnfuzhi(id){
	ymPrompt.close();
	ymPrompt.win({
		title:'添加配送批次分支',
		fixPosition:true,
		maxBtn:true,
		width: 950, 
		height: 560,
		iframe:{
			src:'/admin_sendfen/add?sendfen_id='+id+'&sendpi_id='+{$rs_sendpi.id}+'&endfunc=fnAddSendFenEnd'
		}
	});
} 
 
/* 添加配送批次分支 */
function fnAddSendFen(){
	ymPrompt.close();
	ymPrompt.win({
		title:'添加配送批次分支',
		fixPosition:true,
		maxBtn:true,
		width: 950, 
		height: 560,
		iframe:{
			src:'/admin_sendfen/add?sendpi_id='+{$rs_sendpi.id}+'&endfunc=fnAddSendFenEnd'
		}
	});
}
function fnAddSendFenEnd(){
	grids.reload();
}
/* 修改配送分支 */
function fnModifyFen(id){
	ymPrompt.close();
	ymPrompt.win({
		title:'修改配送批次分支',
		fixPosition:true,
		maxBtn:true,
		width: 950, 
		height: 560,
		iframe:{
			src:'/admin_sendfen/modify?id='+id+'&endfunc=fnModifyFenEnd'
		},
		handler:handlerModify
	});
}
function handlerModify(tp){
	if(tp=='close'){
		grids.reload();
	}
}

function fnModifyFenEnd(){
	grids.reload();
}
/* 删除配送分支 */
function fnDelFen(id){
	
	fnConfirm({
		str:'确认删除本行数据?',
		func_true:function(){
			$('button').attr('disabled','disabled');
			$.post(
				url_del,
				{
					id:id
				},
				function(e){
					var ok = errorHandler(e);
					if(ok && ok.success=='1'){
						window.location.reload();
					}
					$('button').attr('disabled','');
				}
			);
		}
	}); 
}

function fnLookPacket(id){
	ymPrompt.close();
	ymPrompt.win({
		title:'查看配送包装',
		fixPosition:true,
		maxBtn:true,
		width: 800, 
		height: 500,
		iframe:{
			src:'/admin_sendpi/lookpacket?sendfen_id='+id
		}
	}); 
}

function fnLookUsers(id){
	ymPrompt.close();
	ymPrompt.win({
		title:'查看配送会员',
		fixPosition:true,
		maxBtn:true,
		width: 800, 
		height: 500,
		iframe:{
			src:'/admin_sendpi/lookusers?sendfen_id='+id
		}
	}); 
}


function fnReturn(){
	jumpTo(url_return);
}
</script>
<!--#include file="../nav/admin_bottom.php" -->